package com.yuwei.live.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.image.glide.GlideImageLoader
import com.yuwei.live.R
import com.yuwei.database.entity.GoodsEntityItem

class GoodsAdapter: BaseQuickAdapter<GoodsEntityItem, BaseViewHolder>(
    R.layout.item_goods
) {
    override fun convert(holder: BaseViewHolder, item: GoodsEntityItem) {
        val icon = holder.getView<ImageView>(R.id.goods_icon)
        GlideImageLoader.loadImage(icon.context,icon,item.goods_default_icon)
        holder.setText(R.id.goods_desc,item.goods_desc)
            .setText(R.id.goods_price,"￥${item.goods_default_price}")
            .setText(R.id.goods_attribute,item.goods_attribute)
            .setText(R.id.goods_order,"${holder.layoutPosition+1}")
    }
}